package com.liang.factorial;

public class FactorialDemo1 {
    public static void main(String[] args) {
        int i = 5;
        int result = method(5);
        System.out.println(result);
    }

    private static int method(int i) {
        if(i==1){
            return 1;
        }else{
            return i + method(i - 1);
        }
    }
}
